<!DOCTYPE HTML>
<html>
<script>
var canvas, context, pattern, image;

function runTest() {
  if (window.testRunner)
    testRunner.waitUntilDone();

  canvas = document.getElementById('canvas');
  context = canvas.getContext('2d');

  image = document.createElement('img');
  image.setAttribute('src', 'resources/svg-with-image-with-foreignobject.svg');
  image.onload = function() {
    pattern = context.createPattern(image, 'repeat');
    context.fillStyle = pattern;
    context.fillRect(0, 0, 100, 100);
    try {
      // This should throw an exception.
      var pixels = context.getImageData(0, 0, 1, 1).data;
      finishTest('FAIL - svg with feImage with foreignObject did not taint the canvas.');
    } catch (e) {
      finishTest('PASS');
    }
  }
}

function finishTest(output) {
  document.write(output);
  if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.notifyDone();
  }
}
</script>
<body onload='runTest()'>
  Test for crbug.com/279445: An SVG image with an image with a foreignObject should taint the canvas.<br/>
  FAIL - test did not run.<br/>
<canvas id='canvas' width='100' height='100'></canvas>
</body>
</html>
